<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  
</body>
<script>
    const p1 = new Promise((resolve,reject)=>{
    try{
      // throw new Error(`网络异常1`)
      console.log(`请求A数据`);
      setTimeout(()=>{

        console.log(`请求A数成功`);
        resolve(`ok`)
        // reject(`失败1`)
      },2000)
    }catch(e){
      // console.log(e);
      // console.log(e.message);
      reject(e.message)
    }
  })
  // p1.then(()=>{},()=>{})
   const p2 =p1.then((value)=>{
    // co  nsole.log(11);
    // console.log(value);

    return new Promise((resolve,reject)=>{
      console.log(`请求B数据`);
      // console.aa();
      // throw new Error()
    setTimeout(()=>{
      console.log(`请求B数据成功`,value);
      // resolve(`b数据`)
      reject(`b数据错误`)
    },2000)
    })
  })

console.log(`p1`,p1);
console.log(`p2`,p2);
</script>
</html>